#include "stdafx.h"
#include <iostream>
#include <fstream>
#include "Bricks.h"

int main()
{
	std::ifstream file("input.txt");
    std::string word; 
    std::vector<std::string> bricks; 
    Bricks bricksSolution;

	file >> word;
	while (!file.eof())
    {
        std::string brick;
        file >> brick;
        if (brick.size() == 0)
        {
            break;
        }
        bricks.push_back(brick);
    }
    file.close();
	if (bricks.size() < word.size())
    {
		std::cout << "NO" << std::endl;
		return 0;
	}
    bricksSolution.execute(word, bricks);
    return 0;
}